package java10;
import java.sql.*;
public class Test01 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
//        Class.forName("com.mysql.jdbc.Driver");
        //获取数据库的连接对象
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db1","root","root");
        //定义mysql语句
        String sql = "update student set math = 100 where id = 2";
        //获取执行sql的对象Statement
        Statement sta = conn.createStatement();
        //执行sql、
        int count = sta.executeUpdate(sql);
        //处理结果
        System.out.println(count);
        //释放资源
        sta.close();
        conn.close();
    }
}
